package com.jxs.android.weixi;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.jxs.android.util.SmsUtils;
import com.jxs.android.util.StringUtils;
import com.jxs.android.weiget.BuAlertDailog;
import com.jxs.android.weiget.TopBar;
import com.telecom.weixi.R;

public class LaucherSystemMore_Invite extends AbstractActivity {
	private EditText invite_friend_number;
	private EditText invite_friend_name;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		initTopBar(savedInstanceState, R.layout.bu_sys_more_invite_friend);
		initLayouts();
	}

	private void initLayouts() {
		invite_friend_number = (EditText) findViewById(R.id.invite_friend_number);
		invite_friend_name = (EditText) findViewById(R.id.invite_friend_name);
	}

	@Override
	public void topBarLogic(TopBar topBar) {
		topBar.hindBtn();
		topBar.setTitle(R.string.bu_more_invite);
		topBarReturn(topBar);
	}

	public void inviteSumbit(View view) {
		if (StringUtils.isEmpety(invite_friend_number.getText().toString())) {
			errorMsgPop(R.string.error_not_input_invite_number);
		} else {
			SmsUtils.sendSMS4Invite(this, invite_friend_name.getText().toString(), invite_friend_number.getText().toString());
			errorMsgPop(R.string.bu_more_invite_sms_succuss, new BuAlertDailog.IPhoneAlertDailog() {

				@Override
				public void okLogic(Dialog dialog) {
					finish();
				}

				@Override
				public String getOkText(Context context) {
					return null;
				}
			});
		}
	}
}